package selcoursesys.entity;

import javax.persistence.*;

/**
 * Created by Lpbdz on 2017/4/9.
 */
@Entity
@Table(name = "class", schema = "manage_system", catalog = "")
public class ClazzEntity {
    private String classid;
    private String classname;
    private Integer stunum;
    private AcademyEntity academyByAid;

    public void setStunum(int stunum) {
        this.stunum = stunum;
    }

    @Id
    @Column(name = "classid")
    public String getClassid() {
        return classid;
    }

    public void setClassid(String classid) {
        this.classid = classid;
    }

    @Basic
    @Column(name = "classname")
    public String getClassname() {
        return classname;
    }

    public void setClassname(String classname) {
        this.classname = classname;
    }

    @Basic
    @Column(name = "stunum")
    public Integer getStunum() {
        return stunum;
    }

    public void setStunum(Integer stunum) {
        this.stunum = stunum;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ClazzEntity that = (ClazzEntity) o;

        if (classid != null ? !classid.equals(that.classid) : that.classid != null) return false;
        if (classname != null ? !classname.equals(that.classname) : that.classname != null) return false;
        if (stunum != null ? !stunum.equals(that.stunum) : that.stunum != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = classid != null ? classid.hashCode() : 0;
        result = 31 * result + (classname != null ? classname.hashCode() : 0);
        result = 31 * result + (stunum != null ? stunum.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "aid", referencedColumnName = "aid", nullable = false)
    public AcademyEntity getAcademyByAid() {
        return academyByAid;
    }

    public void setAcademyByAid(AcademyEntity academyByAid) {
        this.academyByAid = academyByAid;
    }
}
